package ru.susu.algebra.centralunits.alternating.tex;

import ru.susu.algebra.centralunits.alternating.MathMethodWithInitializers;
import ru.susu.algebra.centralunits.alternating.initializers.SpecialRowsInitializer;
import ru.susu.algebra.jtex.ITexElement;
import ru.susu.algebra.jtex.UnionTexElement;
import ru.susu.algebra.partition.Partition;
import ru.susu.algebra.properties.IPropertySource;

/**
 * @author akargapolov
 * @since: 08.09.2010
 */
public abstract class SpecialCharactersUnionMathMethod extends MathMethodWithInitializers<ITexElement>
{
	@Override
	protected ITexElement directRun(IPropertySource ps) throws Exception
	{
		UnionTexElement union = new UnionTexElement();

		for (Partition partition : SpecialRowsInitializer.listSpecialNotIntegerCharacterRows(ps))
		{
			union.addSubElement(getElement(partition, ps));
		}

		return union;
	}

	protected abstract ITexElement getElement(Partition partition, IPropertySource ps) throws Exception;

}
